<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <!-- Font Awesome CDN -->
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
    />
    <!-- 添加预加载样式和脚本阻止错误通知 -->
    <style>
      /* 隐藏所有错误通知 */
      .el-notification[role="alert"],
      .el-message--error,
      .el-message-box__wrapper,
      .el-overlay.is-message-box,
      div[role="alert"][class*="error"],
      [aria-live="assertive"][class*="error"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
      }
    </style>
    <script>
      // 预先处理错误防止显示通知
      window._errorNotifications = false;
      
      // 全局错误处理
      window.onerror = function(message, source, lineno, colno, error) {
        if (message === 'Script error.' || 
            (typeof message === 'string' && 
             (message.includes('AMap') || 
              message.includes('未捕获的错误: null') || 
              message.includes('Uncaught error: null')))) {
          console.log('已提前拦截错误:', message);
          return true; // 阻止错误继续传播
        }
        return false;
      };
      
      // 处理未捕获的Promise错误
      window.addEventListener('unhandledrejection', function(event) {
        event.preventDefault();
        event.stopPropagation();
        return true;
      }, true);
      
      // 尽早处理DOM中的错误通知
      function removeErrorNotifications() {
        var selectors = [
          '.el-notification[role="alert"]',
          '.el-message--error',
          '.el-message-box__wrapper',
          '.el-overlay.is-message-box'
        ];
        
        selectors.forEach(function(selector) {
          var elements = document.querySelectorAll(selector);
          elements.forEach(function(el) {
            el.style.display = 'none';
            if (el.parentNode) {
              el.parentNode.removeChild(el);
            }
          });
        });
      }
      
      // 不断检查错误通知
      setInterval(removeErrorNotifications, 100);
      
      // 页面加载时
      document.addEventListener('DOMContentLoaded', removeErrorNotifications);
    </script>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>
